<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/main.css" />
    <style type="text/css">
        body {
            background: rgba(190, 190, 190, 0.3);
        }

        .big-box {
            background: #fff;
            border-radius: 20px;
            width: 225px;
            height: 110px;
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            padding-top: 15px;
        }
        .child{
          width: 50%;
          float: left;
          height: 38px;
          text-align: center;
          line-height: 38px;
          font-size: 15px;
          border-top: 1px solid #999999;
        }
        .border-right{
          border-right: 1px solid #999999;
        }
    </style>
</head>

<body>
    <div class="big-box">
        <div style="text-align:center;color:black;font-size:17px;padding-top:15px;padding-bottom:15px">是否确认退出登录？</div>
        <div class="child border-right" onclick="Opencancel()">
          取消
        </div>
        <div class="child" tapmode onclick="logoff()">
          确定
        </div>
        <div class="aui-clearfix"></div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/zepto.js"></script>
<script type="text/javascript" src="../../script/thirdparty.js"></script>
<script type="text/javascript" src="../../script/config.js"></script>
<script type="text/javascript" src="../../script/rest.js"></script>
<script type="text/javascript" src="../../script/faskclick.js"></script>
<script type="text/javascript">
    var  uid=$api.getStorage('uid');
    var  session=$api.getStorage('session');
    function Opencancel() {
        api.closeFrame();
    }
    function logoff() {
      new rest().get('unlogin').datae({
          uid: uid,
          session:session,
          device_id:api.deviceId
      }).success(function(res) {
        // alert(JSON.stringify(res))
          if (res.flag == 1) {
            $api.rmStorage('uid');
            $api.rmStorage('session');
            $api.rmStorage('mobile');
            $api.rmStorage('histortlist')
            api.sendEvent({
                name: 'exitlogin'
            });
            api.closeWin();
          }else{
            api.toast({
                msg: res.msg,
                duration: 2000,
                location: 'bottom'
            });

          }
          console.log(JSON.stringify(res))

      }).error(function(err) {
        api.toast({
            msg: err.msg,
            duration: 2000,
            location: 'middle'
        });
        // alert(JSON.stringify(err))
          console.log(JSON.stringify(err))
      }).run()


    }
</script>

</html>
